<template>
	<div class="ad-banner">
		<uv-swiper :list="listData" indicator indicatorMode="line" circular height='320rpx' keyName="image" @click='toRouter'></uv-swiper>
	</div>
</template>

<script setup>
	import { ref, computed } from 'vue';
	import { useGeneralStore } from '@/store/general.js'

	const generalStore = useGeneralStore();

	const listData = computed(() => {
		return generalStore.recommendList
			.filter(item => item['recommend_id'] === 2)
			.map(item => ({ ...item, title: item['name'] }))
	})

	function toRouter(index) {
		const item = listData.value[index];
		if (item['url']) {
			uni.navigateTo({
				url: item['url']
			})
		}
	}
</script>

<style lang="scss" scoped>
	.ad-banner {
		margin-bottom: 32rpx;
	}
</style>